class BaseAction:
    def __init__(self, driver):
        self.driver = driver

    # 定位基本元素
    def find_e(self, feature):
        return self.driver.find_element(*feature)

    # 定位数字元素
    def find_ele_num(self, feature, num):
        # 因为这里需要将元素格式化 format 一下, 因此就不用解包
        # 需将 num 转换为 str 进行格式化
        return self.driver.find_element(feature[0], feature[1].format(str(num)))

    # 输入内容
    def input(self, feature, context):
        return self.find_e(feature).send_keys(context)

    # 点击
    def click(self, feature):
        self.find_e(feature).click()

    # 清空
    def clear(self, feature):
        self.find_e(feature).clear()